/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.feedback.service.api;

import com.alibaba.fastjson2.JSON;
import info.peigen.hotpot.component.feedback.service.order.FeedbackOrder;
import info.peigen.hotpot.component.feedback.service.result.FeedbackResult;
import info.peigen.hotpot.component.open.api.facade.OpenApiServiceFacade;
import info.peigen.hotpot.component.open.api.facade.processor.base.OpenApiProcessorServiceContext;
import org.noear.solon.annotation.Component;

/**
 * <b>(FeedbackApiService)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/11/17
 */
@SuppressWarnings("ALL")
@Component("feedbackApiService")
public class FeedbackApiService extends AbstractFeedbackApiService implements OpenApiServiceFacade {
    @Override
    public void execute(OpenApiProcessorServiceContext serviceContext) {
        FeedbackOrder  feedbackOrder  = JSON.parseObject(serviceContext.getApi().getDecrypt(), FeedbackOrder.class);
        FeedbackResult feedbackResult = feedbackService.feedback(feedbackOrder);

        serviceContext.getResult().setResult(feedbackResult);
    }
}